﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace FUSE
{
    public class StartPlanet : FUSE.GalaxyComponent
    {
        public const float MIN_ANGLE = 0.0f;
        public const float MAX_ANGLE = 180.0f;

        private float launchAngle;
        private const float angleDelta = 0.1f;

        public StartPlanet() : base()
        {
            launchAngle = 90.0f;
        }

        public override void LoadContent(Microsoft.Xna.Framework.Graphics.Texture2D newTexture)
        {
            base.LoadContent(newTexture);
            this.ComponentBounds.radius = Math.Min(newTexture.Height, (newTexture.Width / 2));
        }

        public override void SetRenderPosition(float xCoord, float yCoord)
        {
            this.RenderPosition = new Vector2(xCoord, yCoord);
            this.ComponentBounds.centerPOS = new Vector2(xCoord +
                (this.ComponentTexture.Width / 2), yCoord + this.ComponentTexture.Height);
        }

        public override void SetCenterPosition(float xCoord, float yCoord)
        {
            this.ComponentBounds.centerPOS = new Vector2(xCoord, yCoord);
            this.RenderPosition = new Vector2(xCoord -
                (this.ComponentTexture.Width / 2), yCoord - this.ComponentTexture.Height);
        }

        public float LaunchAngle
        {
            get
            {
                return launchAngle;
            }

            set
            {
                launchAngle = value;
            }
        }

        public void IncrementAngle()
        {
            if (launchAngle < 180.0f)
                launchAngle += angleDelta;
        }

        public void DecrementAngle()
        {
            if (launchAngle > 0.0f)
                launchAngle -= angleDelta;
        }
    }
}
